home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / stevie.arc / STEVIE.H < prev    next >
Text File  |  1990-01-10  |  5KB  |  231 lines

  1.  
  2. / * Turbo C 1.5 port by: Denny Muscatelli 061988 */
  3.  
  4. /* #define    ATARI        */    /* For the Atari ST */
  5. /* #define    UNIX            */    /* System V */
  6. #define    OS2                        /* Microsoft OS/2 */
  7. #define TURBO                           /* for Turbo C */
  8.  
  9. /*
  10.  * If ATARI is defined, one of the following compilers must be selected.
  11.  */
  12. #ifdef    ATARI
  13. #define    MEGAMAX            /* Megamax Compiler */
  14. /* #define    ALCYON        /* Alcyon C compiler */
  15. #endif
  16.  
  17. /*
  18.  * If HELP is defined, the :help command shows a vi command summary.
  19.  */
  20. #define    HELP            /* enable help command */
  21.  
  22. #include <stdio.h>
  23. #include <ctype.h>
  24. #include <string.h>
  25. #include "ascii.h"
  26. #include "keymap.h"
  27. #include "param.h"
  28. #include "term.h"
  29.  
  30. extern    char    *strchr();
  31.  
  32. #define NORMAL 0
  33. #define CMDLINE 1
  34. #define INSERT 2
  35. #define APPEND 3
  36. #define FORWARD 4
  37. #define BACKWARD 5
  38.  
  39. /*
  40.  * Boolean type definition and constants
  41.  */
  42. typedef    short    bool_t;
  43.  
  44. #ifndef    TRUE
  45. #define    FALSE    (0)
  46. #define    TRUE    (1)
  47. #endif
  48.  
  49. /*
  50.  * SLOP is the amount of extra space we get for text on a line during
  51.  * editing operations that need more space. This keeps us from calling
  52.  * malloc every time we get a character during insert mode. No extra
  53.  * space is allocated when the file is initially read.
  54.  */
  55. #define    SLOP    10
  56.  
  57. /*
  58.  * LINEINC is the gap we leave between the artificial line numbers. This
  59.  * helps to avoid renumbering all the lines every time a new line is
  60.  * inserted.
  61.  */
  62. #define    LINEINC    10
  63.  
  64. /*
  65.  * See 'normal.c' for a description of can_undo.
  66.  */
  67. extern    bool_t    can_undo;
  68.  
  69. #define CHANGED Changed = !(can_undo = FALSE)
  70. #define UNCHANGED Changed=0
  71.  
  72. struct    line {
  73.     struct    line    *prev, *next;    /* previous and next lines */
  74.     char    *s;            /* text for this line */
  75.     int    size;            /* actual size of space at 's' */
  76.     unsigned int    num;        /* line "number" */
  77. };
  78.  
  79. #define    LINEOF(x)    (x->linep->num)
  80.  
  81. struct    lptr {
  82.     struct    line    *linep;        /* line we're referencing */
  83.     int    index;            /* position within that line */
  84. };
  85.  
  86. typedef    struct line    LINE;
  87. typedef    struct lptr    LPTR;
  88.  
  89. struct charinfo {
  90.     char ch_size;
  91.     char *ch_str;
  92. };
  93.  
  94. extern struct charinfo chars[];
  95.  
  96. extern int State;
  97. extern int Rows;
  98. extern int Columns;
  99. extern char *Realscreen;
  100. extern char *Nextscreen;
  101. extern char *Filename;
  102. extern LPTR *Filemem;
  103. extern LPTR *Fileend;
  104. extern LPTR *Topchar;
  105. extern LPTR *Botchar;
  106. extern LPTR *Curschar;
  107. extern LPTR *Insstart;
  108. extern int Cursrow, Curscol, Cursvcol, Curswant;
  109. extern bool_t set_want_col;
  110. extern int Prenum;
  111. extern bool_t Debug;
  112. extern bool_t Changed;
  113. extern bool_t Binary;
  114. extern char Redobuff[], Undobuff[], Insbuff[];
  115. extern LPTR *Uncurschar;
  116. extern char *Insptr;
  117. extern int Ninsert, Undelchars;
  118.  
  119. extern char *malloc(), *strcpy();
  120.  
  121. /*
  122.  * alloc.c
  123.  */
  124. char    *alloc(), *strsave();
  125. void    screenalloc(), filealloc(), freeall();
  126. LINE    *newline();
  127. bool_t    bufempty(), buf1line(), lineempty(), endofline(), canincrease();
  128.  
  129. /*
  130.  * cmdline.c
  131.  */
  132. void    readcmdline(), dotag(), msg(), emsg(), smsg(), gotocmd(), wait_return();
  133.  
  134. /*
  135.  * edit.c
  136.  */
  137. void    edit(), insertchar(), getout(), scrollup(), scrolldown(), beginline();
  138. bool_t    oneright(), oneleft(), oneup(), onedown();
  139.  
  140. /*
  141.  * fileio.c
  142.  */
  143. void    filemess(), renum();
  144. bool_t    readfile(), writeit();
  145.  
  146. /*
  147.  * help.c
  148.  */
  149. bool_t    help();
  150.  
  151. /*
  152.  * linefunc.c
  153.  */
  154. LPTR    *nextline(), *prevline(), *coladvance();
  155.  
  156. /*
  157.  * main.c
  158.  */
  159. void    stuffin(), stuffnum(), addtobuff();
  160. int    vgetc(), vpeekc();
  161. bool_t    anyinput();
  162.  
  163. /*
  164.  * mark.c
  165.  */
  166. void    setpcmark(), clrall(), clrmark();
  167. bool_t    setmark();
  168. LPTR    *getmark();
  169.  
  170. /*
  171.  * misccmds.c
  172.  */
  173. void    opencmd(), fileinfo(), inschar(), insstr(), delline();
  174. bool_t    delchar();
  175. int    cntllines(), plines();
  176. LPTR    *gotoline();
  177.  
  178. /*
  179.  * normal.c
  180.  */
  181. void    normal(), resetundo();
  182. char    *mkstr();
  183.  
  184. /*
  185.  * param.c
  186.  */
  187. void    doset();
  188.  
  189. /*
  190.  * ptrfunc.c
  191.  */
  192. int    inc(), dec();
  193. int    gchar();
  194. void    pchar(), pswap();
  195. bool_t    lt(), gt(), equal(), ltoreq(), gtoreq();
  196.  
  197. /*
  198.  * screen.c
  199.  */
  200. void    updatescreen(), updateline();
  201. void    screenclear(), cursupdate();
  202. void    s_ins(), s_del();
  203.  
  204. /*
  205.  * search.c
  206.  */
  207. void    dosearch(), repsearch();
  208. bool_t    searchc(), crepsearch(), findfunc();
  209. LPTR    *showmatch();
  210. LPTR    *fwd_word(), *bck_word(), *end_word();
  211.  
  212. /*
  213.  * Machine-dependent routines.
  214.  */
  215. int    inchar();
  216. void    outchar(), outstr(), beep();
  217.  
  218. /* added 061488 for turbo c port - dlm */
  219.  
  220. #ifndef    OS2 || TURBO
  221. void    remove(), rename();
  222. #endif
  223. void    windinit(), windexit(), windgoto();
  224.  
  225. /* added 061488 for turbo c port - dlm */
  226.  
  227. #ifdef TURBO
  228. void    mdelay();
  229. #else
  230. void    delay();
  231. #endif